Skip to content

Fix pytorch comparisonFix: Replace duplicate OpenVINO code with PyTorch code in comparison section#27019

Open
chaya2350 wants to merge 2 commits intomicrosoft:gh-pagesfrom
chaya2350:fix-pytorch-comparison
Open

Fix pytorch comparisonFix: Replace duplicate OpenVINO code with PyTorch code in comparison section#27019
chaya2350 wants to merge 2 commits intomicrosoft:gh-pagesfrom
chaya2350:fix-pytorch-comparison

Conversation

@chaya2350
Copy link

Fix: Replace OpenVINO code with PyTorch code in PyTorch comparison section

The 'Comparison with PyTorch' section was incorrectly showing OpenVINO code instead of PyTorch code. This fix uses the actual PyTorch model (resnet50) that was loaded earlier in the tutorial for comparison with ONNX Runtime.

Fixes #25661

Description

The "Comparison with PyTorch" section incorrectly contained OpenVINO code instead of PyTorch code. Both the "Comparison with PyTorch" and "Comparison with OpenVINO" sections had identical code blocks, which was confusing for users following the tutorial.

This PR fixes the issue by:

  • Replacing the duplicate OpenVINO code with proper PyTorch inference code
  • Using the resnet50 PyTorch model that was already loaded earlier in the tutorial
  • Updating the sample output to reflect PyTorch execution times and verification results
  • Ensuring the comparison correctly benchmarks PyTorch against ONNX Runtime

Motivation and Context

This change is required to fix a documentation bug where readers couldn't properly compare PyTorch performance with ONNX Runtime, as both comparison sections showed OpenVINO code.

Fixes #25661

The fix ensures that users following this tutorial can now correctly:

  • See how to run inference with pure PyTorch
  • Compare PyTorch performance against ONNX Runtime
  • Verify the correctness of ONNX Runtime outputs against PyTorch outputs

…ction

The 'Comparison with PyTorch' section was incorrectly showing OpenVINO code
instead of PyTorch code. This fix uses the actual PyTorch model (resnet50)
that was loaded earlier in the tutorial for comparison with ONNX Runtime.

Fixes microsoft#25661
@chaya2350
Copy link
Author

@microsoft-github-policy-service agree

@chaya2350
Copy link
Author

Hi! 👋

This documentation fix PR has been open for a week. Could someone please take a look?

It's a small fix - the "Comparison with PyTorch" section was incorrectly showing OpenVINO code instead of actual PyTorch code.

@danielzgtg - as the issue reporter, does this fix look correct to you?

@skottmckay @jchen351 @justinchuby - could one of you please review when you have a moment?

Thanks! 🙂

@danielzgtg
Copy link

I confirm that this fixes my reported issue now that the duplication is gone. 👍

I will simply trust that your Sample output indicates that the code works. Someone else should run it because I don't have a Nvidia GPU or the correct library versions.

@justinchuby justinchuby added the documentation improvements or additions to documentation; typically submitted using template label Jan 21, 2026
@justinchuby justinchuby requested a review from MaanavD January 21, 2026 17:03
@chaya2350
Copy link
Author

@MaanavD @justinchuby
can you review my PR?
Thanks!

The link https://aka.ms/onnx/modeltypes points to a Microsoft-internal
SharePoint document that is not publicly accessible, causing CI link
checks to fail with 404. This removes the broken link.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation improvements or additions to documentation; typically submitted using template

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants